import javax.swing.*;
import java.awt.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class JavaSecurity {
    public static void main(String[] args)throws IOException
    {
        int quan=1;
        if(quan==0)
        {
            EventQueue.invokeLater(()->{
                var frame=new ClassLoaderFrame();
                frame.setTitle("ClassLoaderTest");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
            });
        }
        else if(quan==1)
        {
            for(int i=0;i<args.length;++i)
            {
                System.out.println(args[i]);
            }
            if(args.length!=3)
            {
                System.out.println("USAGE: java classLoader.Caesar in out key");
                return ;
            }
            try(var in=new FileInputStream(args[0]);
            var out =new FileOutputStream(args[1])
            )
            {
                int key=Integer.parseInt(args[2]);
                int ch;
                while ((ch=in.read())!=-1)
                {
                    byte c=(byte)(ch+key);
                    out.write(c);
                }
            }
        }

    }
}
